package com.qf.loanapplication;

import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.qf.borrower.Borrower;
import com.qf.loanrepayment.Loanrepayment;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @author H
 * @create 2020-11-03 15:08
 * @strive To be whoever you want to be.
 * @Description: 贷款申请表-订单 loanapplication
 * id,贷款人id(外键)，操作员id（审批人-外键），
 * <p>
 * 贷款用途，贷款金额，贷款申请时间，贷款开始时间(审批日期)，贷款时长，贷款申请状态（审批中-已通过-未通过），
 * <p>
 * id,borrowerId,operatorId,
 * <p>
 * loanPurpose,loanAmount,createTime,startTime,loanDuration,status,
 */
@Entity
@Data
@Table(name = "loanapplication")
public class Loanapplication {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    @Column(name = "borrower_id")
    private Integer borrowerId;
    @Column(name = "operator_id")
    private Integer operatorId;
    @Column(name = "loan_purpose")
    private String loanPurpose;
    @Column(name = "loan_amount")
    private Double loanAmount;

    @Column(name = "create_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "start_time")
    private Date startTime;

    @Column(name = "loan_duration")
    private Integer loanDuration;
    private String status;

    private String attribute1;
    private String attribute2;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getBorrowerId() {
        return borrowerId;
    }

    public void setBorrowerId(Integer borrowerId) {
        this.borrowerId = borrowerId;
    }

    public Integer getOperatorId() {
        return operatorId;
    }

    public void setOperatorId(Integer operatorId) {
        this.operatorId = operatorId;
    }

    public String getLoanPurpose() {
        return loanPurpose;
    }

    public void setLoanPurpose(String loanPurpose) {
        this.loanPurpose = loanPurpose;
    }

    public Double getLoanAmount() {
        return loanAmount;
    }

    public void setLoanAmount(Double loanAmount) {
        this.loanAmount = loanAmount;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Integer getLoanDuration() {
        return loanDuration;
    }

    public void setLoanDuration(Integer loanDuration) {
        this.loanDuration = loanDuration;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getAttribute1() {
        return attribute1;
    }

    public void setAttribute1(String attribute1) {
        this.attribute1 = attribute1;
    }

    public String getAttribute2() {
        return attribute2;
    }

    public void setAttribute2(String attribute2) {
        this.attribute2 = attribute2;
    }


    @Transient
    private Loanrepayment loanrepayment;
    @Transient
    private Borrower borrower;
}

